﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.ServiceModel;

namespace Host
{
    public partial class ServiceHost : ServiceBase
    {
        System.ServiceModel.ServiceHost host = null;
        public ServiceHost()
        {
            InitializeComponent();
            host = new System.ServiceModel.ServiceHost(typeof(ServiceImplementation.Service));
            
        }

        protected override void OnStart(string[] args)
        {
            
            host.Open();
        }

        

        protected override void OnStop()
        {
            if (host != null && host.State == CommunicationState.Opened)
            {
                host.Close();
            }
           
        }    
    }
}
